NCO-63: Fix DDL query handling in streaming mode#62
Merged
Merged
Conversation
SDK: - Handle responses without "results" array (DDL statements like CREATE/DROP DATABASE) - Skip unknown JSON attributes (signature, plans, etc.) to avoid stream corruption - Add unit tests for DDL response handling Performer: - Make CloseQueryResult idempotent to handle close-after-cancel - Add disableConsoleRead argument for headless Docker operation
emilienbev
approved these changes
May 7, 2026
There was a problem hiding this comment.
Pull request overview
This PR improves the analytics streaming result parser to correctly handle non-row (DDL) responses and avoid JSON stream desynchronization when extra top-level attributes are present, and it adjusts the FIT performer to tolerate close-after-cancel behavior.
Changes:
- Update
StreamingAnalyticsResultto initialize successfully when the response has no"results"array and to skip/consume unknown top-level JSON attributes to prevent stream corruption. - Add unit tests + a new JSON fixture covering DDL responses with no rows/results.
- Make the FIT performer’s
CloseQueryResultidempotent and add a headless mode option to avoid blocking on console input.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
tests/Couchbase.Analytics.UnitTests/JsonDocuments/ddlResponse.json |
Adds a representative DDL success response fixture with no results array and extra attributes. |
tests/Couchbase.Analytics.UnitTests/Internal/StreamingAnalyticsResultTests.cs |
Adds tests validating DDL initialization, empty enumeration, and metrics availability. |
tests/Couchbase.Analytics.UnitTests/Couchbase.Analytics.UnitTests.csproj |
Ensures the new DDL fixture is copied to the test output directory. |
src/Couchbase.Analytics/Internal/Results/StreamingAnalyticsResult.cs |
Implements “no results array” handling and consumes unknown attributes to keep the stream reader aligned. |
fit/Couchbase.Analytics.Performer/Program.cs |
Adds disableConsoleRead mode for headless operation. |
fit/Couchbase.Analytics.Performer/Internal/Services/AnalyticsPerformerCrossService.cs |
Makes CloseQueryResult idempotent by succeeding even if the handle was already removed. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
our robot overlords are right on this one Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SDK:
Performer: